package org.wyn.action;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.wyn.common.ResultType;
import org.wyn.mongodb.bean.UserStatus;
import org.wyn.service.IStatusService;

import com.google.inject.Inject;

/**
 * 状态action
 * @author wyn
 *
 */
@Namespace("/status")
@ParentPackage("security")
public class StatusAction extends WynActionSupport{
	
	@Action(value="goStatus",results = {@Result(name = SUCCESS, type = ResultType.FREEMARKER, location = "status.ftl")})
	public String goStatus(){
		userStatusList = iStatusService.getFriendStatus(getLoginUserName());
		return SUCCESS;
	}
	/**
	 * 发布状态
	 * @return
	 */
	@Action(value="publishStatus",results = {@Result(name = SUCCESS, type = ResultType.FREEMARKER, location = "status.ftl")})
	public String publishStatus(){
		iStatusService.publishStatus(getLoginUserName(), content);
		return SUCCESS;
	}
	private String content;
	private List<UserStatus> userStatusList;
	@Inject
	private IStatusService iStatusService;
	private static final long serialVersionUID = 1L;
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public IStatusService getiStatusService() {
		return iStatusService;
	}
	public void setiStatusService(IStatusService iStatusService) {
		this.iStatusService = iStatusService;
	}
	public List<UserStatus> getUserStatusList() {
		return userStatusList;
	}
	public void setUserStatusList(List<UserStatus> userStatusList) {
		this.userStatusList = userStatusList;
	}

}
